/**
 * 
 */
package org.nobject.common.swing.g;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.LayoutManager;

import javax.swing.JTabbedPane;

/**
 * GTabbedPane
 *
 * @author bianrongjun
 * @version 1.0
 */
public class GTabbedPane extends JTabbedPane  implements IG{

	/**
	 * 构造函数 
	 */
	public GTabbedPane() {
		super();
		this.core=new GComponent();
	}

	/**
	 * 构造函数 
	 * @param container
	 * @param name
	 * @param constraints
	 * @param preferredSize
	 */
	public GTabbedPane(Container container,String name,Object constraints,Dimension preferredSize){
		this();
		if(name!=null) this.setName(name);
		if(constraints==null)container.add(this);
		else container.add(this,constraints);
		
		if(preferredSize==null)preferredSize=new Dimension(-1,-1);
		if(preferredSize.width<0) preferredSize.width=container.getWidth();
		if(preferredSize.height<0) preferredSize.height=container.getHeight();
		this.setPreferredSize(preferredSize);
	}

	/**
	 * 构造函数 
	 * @param container
	 * @param name
	 * @param constraints
	 * @param preferredSize
	 * @param layoutManager
	 */
	public GTabbedPane(Container container,String name,Object constraints,Dimension preferredSize,LayoutManager layoutManager){
		this(container, name, constraints, preferredSize);
		this.setLayout(layoutManager);
	}
	
	/**
	 * 构造函数 
	 * @param container
	 * @param name
	 */
	public GTabbedPane(Container container,String name){
		this(container, name,null,null);
	}

	/**
	 * 构造函数 
	 * @param container
	 * @param name
	 * @param preferredSize
	 */
	public GTabbedPane(Container container,String name,Dimension preferredSize){
		this(container, name,null,preferredSize);
	}
	
	/**
	 * 构造函数 
	 * @param container
	 * @param preferredSize
	 */
	public GTabbedPane(Container container,Dimension preferredSize){
		this(container, null,null,preferredSize);
	}
	
	/**
	 * 构造函数 
	 * @param preferredSize
	 * @param layoutManager
	 */
	public GTabbedPane(Container container,Dimension preferredSize,LayoutManager layoutManager){
		this(container, null,null,preferredSize);
		this.setLayout(layoutManager);
	}
	
	/**
	 * 构造函数 
	 * @param preferredSize
	 * @param layoutManager
	 */
	public GTabbedPane(Dimension preferredSize,LayoutManager layoutManager){
		this(null, null,null,preferredSize);
		this.setLayout(layoutManager);
	}
	
	/** IG */
	private GComponent core;
	public GComponent getGCore() {return core;}
	
	
	public void paintChildren(Graphics g) {core.paintChildren(g);super.paintChildren(g);}
}
